package ai.plantdata.dao.util;

import java.math.BigDecimal;
import java.sql.Clob;
import java.util.Date;

/**
 * @Author: WangHui
 * @Date: 2021/7/15 15:43
 * @Description:
 */
public class DataTypeUtil {

    public static int classToDataType(Class<?> cla) {
        if (cla.isAssignableFrom(Integer.class)) {
            return 1;
        } else if (cla.isAssignableFrom(Long.class)) {
            return 1;
        } else if (cla.isAssignableFrom(String.class)) {
            return 5;
        } else if (cla.isAssignableFrom(Byte.class)) {
            return 1;
        } else if (cla.isAssignableFrom(BigDecimal.class)) {
            return 2;
        } else if (cla.isAssignableFrom(Short.class)) {
            return 1;
        } else if (cla.isAssignableFrom(Date.class)) {
            return 4;
        } else if (cla.isAssignableFrom(Clob.class)) {
            return 10;
        } else {
            return 5;
        }
    }

}
